unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
  Figure = class
    x, y, a : integer;
    procedure Draw; virtual;
    procedure Make; virtual;
  end;
  Circle = class(Figure)
    procedure Draw; override;
    procedure Make; override;
  end;
  Square = class(Figure)
    procedure Draw; override;
    procedure Make; override;
  end;
  FixedSquare = class(Figure)
    procedure Draw; override;
    procedure Make; override;
  end;
var
  Form1: TForm1;
  mas : array[0..99] of Figure;
implementation

{$R *.dfm}

{ Circle }

procedure Circle.Draw;
begin
  inherited;
  Form1.Image1.Canvas.Ellipse(x-a, y-a, x+a, y+a);
end;

procedure Circle.Make;
begin
  inherited;
  x := random(Form1.Image1.Width);
  y := random(Form1.Image1.Height);
  a := random(50);
end;

{ Figure }

procedure Figure.Draw;
begin

end;

procedure Figure.Make;
begin

end;

{ Square }

procedure Square.Draw;
begin
  inherited;
  Form1.Image1.Canvas.Rectangle(x-a, y-a, x+a, y+a);
end;

procedure Square.Make;
begin
  inherited;
  x := random(Form1.Image1.Width);
  y := random(Form1.Image1.Height);
  a := random(50);
end;

{ FixedSquare }

procedure FixedSquare.Draw;
begin
  inherited;
  Form1.Image1.Canvas.Rectangle(x-a, y-a, x+a, y+a);
end;

procedure FixedSquare.Make;
begin
  inherited;
  a := 10;
end;

procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
  for i:=49 to 99 do
  begin
    mas[i] := Circle.Create;
    mas[i].Make;
    mas[i].Draw;
  end;
  for i:= 25 to 49 do
  begin
    mas[i] := Square.Create;
    mas[i].Make;
    mas[i].Draw;
  end;
  for i:= 0 to 24 do
  begin
    mas[i] := FixedSquare.Create;
    mas[i].x := i*20;
    mas[i].y := i*20;
    mas[i].Make;
    mas[i].Draw;
  end;
end;

end.
 